/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2012/08/30
* File: AniKeyFrame.h
* Blog: http://www.cnblogs.com/zengqh/
**/

#ifndef AniKeyFrame_h__
#define AniKeyFrame_h__

#include "../Core/Core.h"
#include "../Core/Declare.h"

class AnimationTrack;
class AniKeyFrame
{
public:
	AniKeyFrame( AnimationTrack* owner, f32 time)
		: _time(time)
		, _parent(owner)
	{

	}

	virtual ~AniKeyFrame() {}

	f32 getTime() const
	{
		return _time;
	}

	f32 setTime(f32 time)
	{
		_time = time;
	}



	bool operator < (const const AniKeyFrame& key_frame) const
	{
		return getTime() < key_frame.getTime();
	}

	void setPos(const glm::vec3& v)
	{
		_pos = v;
	}

	void setScale(const glm::vec3& s)
	{
		_scale = s;
	}

	void setRotate(const glm::quat& r)
	{
		_rotate = r;
	}

	const glm::vec3& getPos() const
	{
		return _pos;
	}

	const glm::vec3& getScale() const
	{
		return _scale;
	}

	const glm::quat& getRotate() const
	{
		return _rotate;
	}

protected:
	AnimationTrack*		_parent;
	f32					_time;
	glm::vec3			_pos;
	glm::vec3			_scale;
	glm::quat			_rotate;
};

struct AniKeyFrameLess
{
public:
	bool operator()( const AniKeyFrame* kf1, const AniKeyFrame* kf2 ) const
	{
		return kf1->getTime() < kf2->getTime();
	}
};
#endif    /* AniKeyFrame_h__ */